package cn.iocoder.yudao.module.erp.service.dpeast;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.erp.controller.admin.dpitem.dpeastlistdn.vo.DpEastListDnPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.dpitem.dpeastlistdn.vo.DpEastListDnSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.dplist.DpEastListDnDO;
import cn.iocoder.yudao.module.erp.dal.mysql.dpeast.DpEastListDnMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*;

/**
 * 东宁东线清单 Service 实现类
 * @author 天使管理员
 */
@Service
@Validated
public class DpEastListDnServiceImpl implements DpEastListDnService {

    @Resource
    private DpEastListDnMapper dpEastListDnMapper;

    @Override
    public Long createDpEastListDn(DpEastListDnSaveReqVO createReqVO) {
        // 插入
        DpEastListDnDO dpEastListDn = BeanUtils.toBean(createReqVO, DpEastListDnDO.class);
        dpEastListDnMapper.insert(dpEastListDn);
        // 返回
        return dpEastListDn.getId();
    }

    @Override
    public void updateDpEastListDn(DpEastListDnSaveReqVO updateReqVO) {
        // 更新
        DpEastListDnDO updateObj = BeanUtils.toBean(updateReqVO, DpEastListDnDO.class);
        dpEastListDnMapper.updateById(updateObj);
    }

    @Override
    public void deleteDpEastListDn(Long id) {
        dpEastListDnMapper.deleteById(id);
    }

    @Override
    public DpEastListDnDO getDpEastListDn(Long id) {
        return dpEastListDnMapper.selectById(id);
    }

    @Override
    public PageResult<DpEastListDnDO> getDpEastListDnPage(DpEastListDnPageReqVO pageReqVO) {
        return dpEastListDnMapper.selectPage(pageReqVO);
    }

}